﻿<!-- #Include File="../../Include/Skin.asp" -->
<!-- #Include File="../../Include/Md5.asp" -->
<%
Data_Name = "{prefix}Admin"
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
	Sql = "Select * From ["&Data_Name&"] Order By ID Asc"
	Call Exe_Conn(Rs,Sql,1)
	i = 0
	If Rs.BOF And Rs.EOF Then
		data = ""
	Else
		If Request("Page") <> "" Then
			CurrentPage = Code_CLng(Request("Page"))
		Else
			CurrentPage = 1
		End If
		MaxPerPage = Code_CLng(Trim(Request("limit")))
		If MaxPerPage <= 0 Then MaxPerPage = 10
		totalPut = Rs.RecordCount
		If CurrentPage < 1 Then
			CurrentPage = 1
		End If
		If (CurrentPage - 1) * MaxPerPage > totalPut Then
			If (totalPut Mod MaxPerPage) = 0 Then
				CurrentPage = totalPut \ MaxPerPage
			Else
				CurrentPage = totalPut \ MaxPerPage + 1
			End If
		End If
		If CurrentPage > 1 Then
			If (CurrentPage - 1) * MaxPerPage < totalPut Then
				Rs.Move (CurrentPage - 1) * MaxPerPage
			Else
				CurrentPage = 1
			End If
		End If
		Do While Not Rs.Eof
			If Rs("LastLoginTime") <> "" Then LastLoginTime = Time_Type(Rs("LastLoginTime"),1)
			If Rs("LastLogoutTime") <> "" Then LastLogoutTime = Time_Type(Rs("LastLogoutTime"),1)
			If Rs("GroupID") = "0" Then
				GroupID = ToUnicode("超级管理员")
			Else
				sqlGroup="select * from Admin_Group where GroupID="&Rs("GroupID")&" And status=1"
				Call Exec(rsGroup,sqlGroup,2)
				If rsGroup.BOF And rsGroup.EOF Then
					rsGroup.Close
				Else
					GroupID = ToUnicode(rsGroup("GroupName"))
					rsGroup.Close
					set rsGroup=Nothing
				End If
			End If
			If i=0 Then
				data = data & "{""id"":"&Rs("id")&",""username"":"""&Rs("UserName")&""",""password"":"""&Decryptstr(Rs("Password"))&""",""GroupID"":"""&GroupID&""",""EnableMultiLogin"":"""&Rs("EnableMultiLogin")&""",""LastLoginIP"":"""&Rs("LastLoginIP")&""",""LastLoginTime"":"""&LastLoginTime&""",""LastLogoutTime"":"""&LastLogoutTime&""",""LoginTimes"":"""&Rs("LoginTimes")&""",""is_open"":"""&Rs("IsOpen")&"""}"
			Else
				data = data & ",{""id"":"&Rs("id")&",""username"":"""&Rs("UserName")&""",""password"":"""&Decryptstr(Rs("Password"))&""",""GroupID"":"""&GroupID&""",""EnableMultiLogin"":"""&Rs("EnableMultiLogin")&""",""LastLoginIP"":"""&Rs("LastLoginIP")&""",""LastLoginTime"":"""&LastLoginTime&""",""LastLogoutTime"":"""&LastLogoutTime&""",""LoginTimes"":"""&Rs("LoginTimes")&""",""is_open"":"""&Rs("IsOpen")&"""}"
			End If
			iCount = iCount + 1
			If iCount >= MaxPerPage Then Exit Do
			Rs.MoveNext
			i=i+1
		Loop
		Rs.Close
	End If
	If totalPut = 0 Then
		Response.Write "{""code"":201,""msg"":""\u65e0\u6570\u636e""}" & vbCrLf
	Else
		Response.Write "{""code"":0,""msg"":""\u83b7\u53d6\u6210\u529f!"",""count"":"&totalPut&",""data"":["&data&"],""rel"":1}" & vbCrLf
	End If
	Response.End()
Else
	Response.Write "<!DOCTYPE html>" & vbCrLf
	Response.Write "<head>" & vbCrLf
	Response.Write "<title>查看用户管理</title>" & vbCrlf
	Response.Write "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" & vbCrLf
	Response.Write "<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-status-bar-style' content='black'>" & vbCrLf
	Response.Write "<meta name='apple-mobile-web-app-capable' content='yes'>" & vbCrLf
	Response.Write "<meta name='format-detection' content='telephone=no'>" & vbCrLf
	Response.Write "<link rel=""stylesheet"" type=""text/css"" href=""../fonts/font-awesome/css/font-awesome.min.css"" />" & vbCrLf
	Response.Write "<link href='../Plugins/layui/css/layui.css' rel='stylesheet' type='text/css' />" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/global.css"" media=""all"">" & vbCrLf
	Response.Write "<link rel=""stylesheet"" href=""../Style/font.css"" media=""all"">" & vbCrLf
	Response.Write "<script type='text/javascript'>" & vbCrLf
	Response.Write "var pc_file = '" & InstallDir & "';" & vbCrLf
	Response.Write "var admin_file = '" & AdminFolder & "/';" & vbCrLf
	Response.Write "</script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../Js/Admin.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/main.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcore.min.js'></script>" & vbCrLf
	Response.Write "<script type='text/javascript' src='../../Dialog/lhgcalendar.min.js'></script>" & vbCrLf
	Response.Write "<script type=""text/javascript"" src=""../Plugins/layui/layui.js""></script>" & vbCrLf
	Response.Write "</head>" & vbCrlf
	Response.Write "<body>" & vbCrlf
	Response.Write "<div class=""admin-main layui-anim layui-anim-upbit"">" & vbCrlf
	Response.Write "    <fieldset class=""layui-elem-field layui-field-title"">" & vbCrlf
	Response.Write "        <legend>查看用户管理</legend>" & vbCrlf
	Response.Write "    </fieldset>" & vbCrlf
	Response.Write "    <table class=""layui-table"" id=""list"" lay-filter=""list""></table>" & vbCrlf
	Response.Write "</div>" & vbCrlf
	Response.Write "<script type=""text/html"" id=""password"">" & vbCrlf
	Response.Write "    <font color='red' onmouseover=""layer.tips('{{d.password}}',this,{tips: [1, '#000']});"" onmouseout=""layer.closeAll();"">******</font>" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "<script type=""text/html"" id=""GroupID"">" & vbCrlf
	Response.Write "    {{# if(d.GroupID=='超级管理员'){ }}" & vbCrlf
	Response.Write "    <font color=blue>超级管理员</font>" & vbCrlf
	Response.Write "    {{# }else{  }}" & vbCrlf
	Response.Write "    {{d.GroupID}}" & vbCrlf
	Response.Write "    {{# } }}" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "<script type=""text/html"" id=""EnableMultiLogin"">" & vbCrlf
	Response.Write "    {{# if(d.EnableMultiLogin=='True'){ }}" & vbCrlf
	Response.Write "    <font color='green'>允许</font>" & vbCrlf
	Response.Write "    {{# }else{  }}" & vbCrlf
	Response.Write "    <font color='red'>不允许</font>" & vbCrlf
	Response.Write "    {{# } }}" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "<script type=""text/html"" id=""open"">" & vbCrlf
	Response.Write "    {{# if(d.is_open=='True'){ }}" & vbCrlf
	Response.Write "    <font color='green'>开启</font>" & vbCrlf
	Response.Write "    {{# }else{  }}" & vbCrlf
	Response.Write "    <font color='red'>关闭</font>" & vbCrlf
	Response.Write "    {{# } }}" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "<script>" & vbCrlf
	Response.Write "    layui.use(['table'], function() {" & vbCrlf
	Response.Write "        var table = layui.table;" & vbCrlf
	Response.Write "        var tableIn = table.render({" & vbCrlf
	Response.Write "            elem: '#list'," & vbCrlf
	Response.Write "            url: '?'," & vbCrlf
	Response.Write "            method:'post'," & vbCrlf
	Response.Write "            title:'管理员列表'," & vbCrlf
	Response.Write "            cellMinWidth: 80," & vbCrLf
	Response.Write "            page:true," & vbCrLf
	Response.Write "            cols: [[" & vbCrlf
	Response.Write "                {field:'id', title: '编号', width:60,fixed: true}" & vbCrlf
	Response.Write "                ,{field:'username', title: '用户名', width:180}" & vbCrlf
	Response.Write "                ,{field:'password', title: '用户密码', width:180,templet: '#password'}" & vbCrlf
	Response.Write "                ,{field:'GroupID', title: '角色', width:180,templet: '#GroupID'}" & vbCrlf
	Response.Write "                ,{field:'EnableMultiLogin', title: '多人登录', width:100,templet: '#EnableMultiLogin'}" & vbCrlf
	Response.Write "                ,{field:'LastLoginIP', title: 'IP地址', width:150}" & vbCrlf
	Response.Write "                ,{field:'LastLoginTime', title: '最后登录时间',width:160}" & vbCrlf
	Response.Write "                ,{field:'LastLogoutTime', title: '最后退出时间',width:160}" & vbCrlf
	Response.Write "                ,{field:'LoginTimes', title: '登录次数',width:150}" & vbCrlf
	Response.Write "                ,{field:'is_open', title: '状态',width:100,templet: '#open'}" & vbCrlf
	Response.Write "            ]]" & vbCrlf
	Response.Write "        });" & vbCrlf
	Response.Write "    });" & vbCrlf
	Response.Write "</script>" & vbCrlf
	Response.Write "</body>" & vbCrLf & "</html>"
End If
%>